package com.tencent.qf.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tencent.qf.user.dal.entity.DwmUserModelInfoRt;
import com.tencent.qf.user.service.DwmUserModelInfoRtService;
import com.tencent.qf.user.dal.mapper.DwmUserModelInfoRtMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author p_haojiawu
* @description 针对表【dwm_user_model_info_rt(实时用户宽表)】的数据库操作Service实现
* @createDate 2023-04-07 14:24:38
*/
@Service
public class DwmUserModelInfoRtServiceImpl extends ServiceImpl<DwmUserModelInfoRtMapper, DwmUserModelInfoRt>
    implements DwmUserModelInfoRtService{

    @Resource
    private DwmUserModelInfoRtMapper dwmUserModelInfoRtMapper;

    @Override
    public DwmUserModelInfoRt getUserPaymentInfoByDWN(String unionId) {
        QueryWrapper<DwmUserModelInfoRt> query = new QueryWrapper<>();
        query.eq("union_id", unionId);
        return dwmUserModelInfoRtMapper.selectOne(query);
    }

    @Override
    public List<DwmUserModelInfoRt> getUserPaymentInfoByDWNs(List<String> unionIds) {
        QueryWrapper<DwmUserModelInfoRt> query = new QueryWrapper<>();
        query.in("union_id", unionIds);
        return dwmUserModelInfoRtMapper.selectList(query);
    }

    @Override
    public IPage<DwmUserModelInfoRt> getUserPaymentInfoPage(Integer page, Integer size) {
        IPage<DwmUserModelInfoRt> dwmUserModelInfoRtIPage = new Page<>(page,size,false);
        QueryWrapper<DwmUserModelInfoRt> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByAsc("id");
        dwmUserModelInfoRtIPage = dwmUserModelInfoRtMapper.selectPage(dwmUserModelInfoRtIPage, queryWrapper);
        return dwmUserModelInfoRtIPage;
    }
}




